<template>
    <view class="cost-record pd-v-24 pd-b-40">
        <view class="pd-v-24 pd-h-32 bg-white border8 mr-t-12 flex flex-center" v-for="(item,index) in list" :key="index+'iiii'">
            <view class="flex-1">
                <view class="font32 lh-44 bold color-default">{{item.deviceInfo}}</view>
                <view class="font26 lh-36 mr-t-16 color-note">{{item.createTime}}</view>
            </view>

            <view class="font32 lh-44 color-red bold">-¥{{item.payAmount}}</view>
        </view>
            
    </view>
</template>

<script setup>
import { useStore } from '@/store/index.js';
import { ref, reactive, onMounted, nextTick } from 'vue';
import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app';
import { orderList } from '@/api/user.js'


const list = ref([])
const params = ref({
    pageNum: 1,
    pageSize: 10,
    status:2
})

const total = ref(0)


onShow(() => {
    
})

onLoad(() => {
    getOrderList()
    

})


onReachBottom(() => {
    if(list.value.length >= total.value) return
    params.value.pageNum++
    getOrderList()
})

const getOrderList = () => {
    orderList(params.value).then(res => {
        console.log(res,'resssssss')
        if(res.code == 200) {
            list.value = [...list.value,...res.rows]
            total.value = res.total
        }
    })
}




</script>

<style scoped lang="scss">
.cost-record {
    background:#F7F7F7;
    min-height:100vh;

    
    
}
</style>
